package com.tang.algorithm.binaryTree;

/**
 * @author tlm
 * @version 1.0
 * @date 2020/8/5 21:59
 */
public class LeetCode104 {
    public int maxDepth(TreeNode root) {
        if (root == null) {
            return 0;
        } else {
            int leftHeight = maxDepth(root.left);
            int rightHeight = maxDepth(root.right);
            return Math.max(leftHeight, rightHeight) + 1;
        }
    }
}
